﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="原材料复检判定单.aspx.cs" Inherits="syc.Inspection.原材料复检判定单" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>原材料复检判定单</title>
<link rel="stylesheet" href="jquery.checkbox.css" />
<link rel="stylesheet" href="jquery.safari-checkbox.css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.checkbox.min.js"></script>
<script type="text/javascript" src="jquery.hoverbox.min.js"></script>
<script type="text/javascript" language="javascript" src="/common.js"></script>
<style type="text/css"> 
#tooltip {
    padding: 5px 5px;
    background: #CCC;
    border: 1px solid #b2bdc3;
}
</style> 
<script type="text/javascript">
    $(document).ready(function() {
        $('input:checkbox:not([safari])').checkbox();
        $('input[safari]:checkbox').checkbox({ cls: 'jquery-safari-checkbox' });
        $('input:radio').checkbox();
        $("#stamp").hide();
        //如果质检结果为CHECK，则全部CHECK
        $("#FormView1_质检结果CheckBox").bind("check", function(e) {
            $("input:checkbox").each(function() {
                $(this).attr('checked', true);
            });
        });
        //如果一打开，就是合格的，则全部都置为合格
        if ($("#FormView1_质检结果CheckBox").attr('checked')) {
            $("input:checkbox").each(function() {
                $(this).attr('checked', true);
            });
        }
        //变化合格不合格函数开始
        $('.torf').each(function() {
            var status = $(this).html();
            if (status == "True") {
                $(this).html('<img src="../Images/tick-icon.png" />');
            } else {
                $(this).html('<img src="../Images/block-icon.png" />');
            }
        }); //合格不合格变化函数结束
        //在CHECK和UNCHECK事件上绑定上函数，检查所有的CHECKBOX并计数，等于8则显示章子，否则继续隐藏
        $("input:checkbox").bind("check uncheck", function(e) {
            var i = 0;
            // $("#FormView1_质检结果CheckBox").attr('checked', false);
            $("input:checkbox").each(function() {
                if ($(this).attr("checked")) ++i;
            });
            //alert(i);
            if (i == 9) {
                $("#stamp").show();
            } else {
                $("#stamp").hide();
            }
        }
        );

    });
						
</script>
</head>
<body>
    <form id="form1" runat="server">
        <div id="test" class="wintop">原材料复检判定单管理</div>
    <asp:Panel ID="Panel1" runat="server" CssClass="panel">
        <asp:Button ID="Button_Save" runat="server" Text="保存" CssClass="button" 
            onclick="Button_Save_Click"/> 
        </asp:Panel>
     <asp:Panel ID="Panel3" runat="server" CssClass="panel2">
        <asp:Label ID="Message" runat="server" Text="·准备就绪" CssClass="prompt"></asp:Label>
    </asp:Panel>
    <div>
    <script type="text/javascript">putBillHead();</script>
    <h2>原材料复验判定单</h2>
    </div>
    
   <div>
       <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
           ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
           DeleteCommand="DELETE FROM [原料到发记录] WHERE [ID] = @ID"
           SelectCommand="SELECT [ID], [供货ID], [车号], [总重量], [总支数],[质检结果] FROM [原料到发记录] WHERE ([ID] = @ID)" 
           UpdateCommand="UPDATE [原料到发记录]
                          SET 
                              [质检结果] = @质检结果
                          WHERE [ID] = @ID 
                          
                          UPDATE 原料到发明细 
                          SET 合格状态=1,判定日期=GETDATE() 
                          WHERE ID=@ID">
           <SelectParameters>
               <asp:QueryStringParameter DefaultValue="0" Name="ID" QueryStringField="ID" 
                   Type="Int32" />
           </SelectParameters>
           <DeleteParameters>
               <asp:Parameter Name="ID" Type="Int32" />
           </DeleteParameters>
           <UpdateParameters>
               <asp:Parameter Name="供货ID" Type="Int32" />
               <asp:Parameter Name="车号" Type="String" />
               <asp:Parameter Name="总重量" Type="Double" />
               <asp:Parameter Name="总支数" Type="Int32" />
               <asp:Parameter Name="质检结果" Type="Boolean" />
               <asp:Parameter Name="检定日期" Type="DateTime" />
               <asp:Parameter Name="ID" Type="Int32" />
               <asp:SessionParameter Name="质检员" SessionField="OperatorName" Type="String" DefaultValue=""/>
           </UpdateParameters>
       </asp:SqlDataSource>
       <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
           ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
           SelectCommand="SELECT [ID], [名称] FROM [原料供货单位]"></asp:SqlDataSource>
       
       <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
           ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
           SelectCommand="SELECT [ID], [合同编号] FROM [原料采购合同]"></asp:SqlDataSource>
       
       <asp:FormView ID="FormView1" runat="server" DataKeyNames="ID" 
           DataSourceID="SqlDataSource2" DefaultMode="Edit">
           <EditItemTemplate>
            
               质检结果:
               <asp:CheckBox ID="质检结果CheckBox" runat="server" Checked='<%# Bind("质检结果") %>' />

<span>供货厂家：</span><asp:DropDownList ID="DropDownList1" runat="server" 
                   DataSourceID="SqlDataSource3" DataTextField="名称" DataValueField="ID" 
                   SelectedValue='<%# Bind("供货ID") %>'>
               </asp:DropDownList>
<br />
&nbsp;<table border="3" cellspacing="2" cellpadding="2" style="border-collapse: collapse;font-size:14px;" bordercolor="#666666">
    <tr>
        <td colspan="2">合同编号</td>
        <td></td>
        <td>产品名称</td>
        <td>油管光管</td>
        <td>执行标准</td>
        <td>APISpec 5CT</td>
    </tr>
    <tr>
        <td colspan="2">钢级</td>
        <td>J55</td>
        <td>规格</td>
        <td>127 X 33.9</td>
        <td>交货状态</td>
        <td>正火</td>
    </tr>
    <tr>
        <td colspan="2">车号</td>
        <td><asp:Label ID="车号Label" runat="server" Text='<%# Eval("车号") %>'></asp:Label></td>
        <td>重量</td>
        <td><asp:Label ID="重量Label" runat="server" Text='<%# Eval("总重量") %>'></asp:Label></td>
        <td>支数</td>
        <td><asp:Label ID="支数Label" runat="server" Text='<%# Eval("总支数") %>'></asp:Label></td>
    </tr>
    <tr>
        <td colspan="2">抗拉伸强度</td>
        <td colspan="1">屈服强度</td>
        <td colspan="2">伸长率</td>
        <td colspan="2">化学成分</td>
    </tr>

    <tr>
        <td colspan="2" align="center" class="cc"><input type="checkbox" unchecked/></td>
        <td colspan="1" align="center" class="cc"><input type="checkbox" unchecked/></td>
        <td colspan="2" align="center" class="cc"><input type="checkbox" unchecked/></td>
        <td colspan="2" align="center" class="cc"><input type="checkbox" unchecked/></td>
    </tr>  
    <tr>
        <td colspan="2">尺寸检查</td>
        <td colspan="1">外观检查</td>
        <td colspan="2">通径试验</td>
        <td colspan="2">无损探伤</td>
    </tr>  
    <tr>
        <td colspan="2" align="center" class="cc"><input type="checkbox" unchecked/></td>
        <td colspan="1" align="center" class="cc"><input type="checkbox" unchecked/></td>
        <td colspan="2" align="center" class="cc"><input type="checkbox" unchecked/></td>
        <td colspan="2" align="center"class="cc"><input type="checkbox" unchecked/></td>
    </tr>   
    <tr>
        <td>综合判定</td>
        <td colspan="6" ><asp:TextBox ID="综合判定" runat="server" TextMode="MultiLine" Rows="8" Columns="70" />
       
        <img id="stamp" alt="stamp" src="stamp.gif" style="position: absolute;left:530px"/>
        <span style="position:absolute;left:530px;"><b>质检员：<%=Session["OperatorName"]%></b></span>        
        </td>
        
    </tr>       
    </table>
                   
           </EditItemTemplate>
       </asp:FormView>  
    

    </div>
    
    <div class="gridframe">
        <div class="gridview">
        
            <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#e5cfab">
		        <tr>
		            <td class="grid-back">
                        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
                            SelectCommand="SELECT [ID], [重量], [支数], [炉号], [批次],[合格状态] FROM [原料到发明细] WHERE ([记录ID] = @ID)" 
                             >
                            <SelectParameters>
                                <asp:QueryStringParameter DefaultValue="0" Name="ID" 
                                    QueryStringField="ID" Type="Int32" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                        <asp:GridView ID="GridView1" runat="server" AllowPaging="True"  
                            AutoGenerateColumns="False" CssClass="grid" DataKeyNames="ID" 
                            DataSourceID="SqlDataSource1" 
                            GridLines="None" ondatabound="GridView1_DataBound" 
                            onpageindexchanged="GridView1_PageIndexChanged" AllowSorting="True" 
                            UseAccessibleHeader="False" >
                            <PagerSettings Visible="False" />
                            <RowStyle CssClass="grid-row-normal" />
                            <SelectedRowStyle   CssClass="grid-row-bright" />
                            <Columns>
                             
                                <asp:BoundField DataField="重量" HeaderText="重量" SortExpression="重量" 
                                    ItemStyle-CssClass="grid" HeaderStyle-CssClass="grid-header"
                                    ItemStyle-Width="80" >
                                </asp:BoundField>
                   
                                <asp:BoundField DataField="支数" HeaderText="支数" SortExpression="支数" 
                                    ItemStyle-CssClass="grid" HeaderStyle-CssClass="grid-header"
                                    ItemStyle-Width="80" >
                                </asp:BoundField>    
                                  
                                <asp:BoundField DataField="炉号" HeaderText="炉号" 
                                    ItemStyle-CssClass="grid" HeaderStyle-CssClass="grid-header" ItemStyle-HorizontalAlign="right"
                                    ItemStyle-Width="80" SortExpression="炉号" >
                                </asp:BoundField>    
                                
                                <asp:BoundField DataField="批次" HeaderText="批次" SortExpression="批次" 
                                    ItemStyle-CssClass="grid" HeaderStyle-CssClass="grid-header"
                                    ItemStyle-HorizontalAlign="center" ItemStyle-Width="80" >
                                </asp:BoundField>
                               
                                <asp:BoundField DataField="合格状态" HeaderText="合格状态" SortExpression="合格状态"
                                    ItemStyle-CssClass="torf" HeaderStyle-CssClass="grid-header"
                                    ItemStyle-HorizontalAlign="center" ItemStyle-Width="80" >
                                </asp:BoundField>
                                

                            </Columns>
                          </asp:GridView>
		            </td>
	            </tr>
	            <tr>
		            <td>   
		                <table width="100%">
		                    <tr>
		                        <td class="pagebar">
                                    <asp:Button ID="Button_Pager_First" runat="server" Text="" ToolTip="首页" 
                                        CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" />
                                    <asp:Button ID="Button_Pager_Prev" runat="server" Text="" ToolTip="上一页" 
                                        CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" />
                                    <input type="button" class="page-split" />第<asp:TextBox ID="TextBox_Pager" runat="server" CssClass="pageturn" 
                                        ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" /><asp:Label ID="Label_Pages" runat="server"></asp:Label><input type="button" class="page-split" />
                                    
                                    <asp:Button ID="Button_Pager_Next" runat="server" Text="" ToolTip="下一页" 
                                        CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+" />
                                    <asp:Button ID="Button_Pager_Last" runat="server" Text="" ToolTip="末页" 
                                        CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" />
                                </td>
                                <td align="right">
                                    <asp:Label ID="Label_Total" runat="server" CssClass="grid_totalrows"></asp:Label>
                                </td>
                            </tr>
                       </table>

		            </td>
	            </tr>
            </table>
            

        </div>
    </div>
     <script type="text/javascript">         putBillFoot();</script>    
 
<script type="text/javascript" language="javascript">
    var textboxs = document.getElementsByTagName("input");
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn" || textboxs[i].className == "intxt1" || textboxs[i].className == "intxt2") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }

    }
    var rows = document.getElementsByTagName("tr");
    for (i = 0; i < rows.length; i++) {

        if (rows[i].className == "grid-row-normal") {
            rows[i].onmouseover = function() { this.className = "grid-row-bright"; };
            rows[i].onmouseout = function() { this.className = "grid-row-normal"; };
            rows[i].onclick = selectRow;
        }
    }
    var tds = document.getElementsByTagName("td");
    for (var i = 0; i < tds.length; i++) {
        if (tds[i].className == "detailheader") {
            tds[i].innerHTML = tds[i].innerHTML.replace("*", "<span class=required>*</span>");
        }
    }

</script>


    </form>
</body>
</html>
